package com.tdzx.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


public class ADEntivity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4855478131771432130L;
	private String adver_Image;
	private String goods_Id;
	private String adver_Seller;
	private String adver_Id;
	private String goods_Name;
	
	public String getGoods_Name() {
		return goods_Name;
	}
	public void setGoods_Name(String goods_Name) {
		this.goods_Name = goods_Name;
	}
	public String getAdver_Id() {
		return adver_Id;
	}
	public void setAdver_Id(String adver_Id) {
		this.adver_Id = adver_Id;
	}
	public String getAdver_Image() {
		return adver_Image;
	}
	public void setAdver_Image(String adver_Image) {
		this.adver_Image = adver_Image;
	}
	public String getGoods_Id() {
		return goods_Id;
	}
	public void setGoods_Id(String goods_Id) {
		this.goods_Id = goods_Id;
	}
	public String getAdver_Seller() {
		return adver_Seller;
	}
	public void setAdver_Seller(String adver_Seller) {
		this.adver_Seller = adver_Seller;
	}
	
	public static List<ADEntivity> getADList(String json) {
		List<ADEntivity> list = new ArrayList<ADEntivity>();
		try {
			JSONArray ja = new JSONArray(json);
			if(ja != null && ja.length() > 0) {
				for(int i = 0; i < ja.length(); i++) {
					JSONObject jo = ja.optJSONObject(i);
					ADEntivity ad = new ADEntivity();
					ad.setAdver_Image(jo.optString("adver_Image"));
					ad.setAdver_Seller(jo.optString("adver_Seller"));
					ad.setGoods_Id(jo.optString("goods_Id"));
					ad.setAdver_Id(jo.optString("adver_Id"));
					ad.setGoods_Name(jo.optString("goods_Name"));
					list.add(ad);
				}
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return list;
	}
}
